package com.cn.remote;

import java.util.concurrent.Semaphore;
import java.util.concurrent.atomic.AtomicBoolean;

public class SeamphoreOneWayImpl {

    private AtomicBoolean hasNotified = new AtomicBoolean(false);
    private Semaphore semaphore;

    public SeamphoreOneWayImpl(Semaphore semaphore) {
        this.semaphore = semaphore;
    }

    public synchronized void release() {
        if (hasNotified.compareAndSet(false, true)) {
            this.semaphore.release();
        }
    }

}
